package cn.legend.travel.comment.dao.persist.repository.impl;

import cn.legend.travel.comment.dao.persist.mapper.*;
import cn.legend.travel.comment.dao.persist.repository.CommentRepository;
import cn.legend.travel.comment.pojo.entity.*;
import cn.legend.travel.comment.pojo.vo.CommentListItemVO;
import cn.legend.travel.comment.pojo.vo.SecondCommentVo;
import cn.legend.travel.common.pojo.vo.PageData;
import cn.legend.travel.common.util.PageInfoToPageDataConverter;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class CommentRepositoryImpl implements CommentRepository {
    @Autowired private GuideCommentMapper guideCommentMapper;
    @Autowired private HotelCommentMapper hotelCommentMapper;
    @Autowired private DelicacyCommentMapper delicacyCommentMapper;
    @Autowired private ProductCommentMapper productCommentMapper;
    @Autowired private ReviewCommentMapper reviewCommentMapper;
    @Autowired private SceneryCommentMapper sceneryCommentMapper;
    @Autowired private DestinationCommentMapper destinationCommentMapper;
    @Override
    public PageData<SecondCommentVo> getSecondComments(Long commentId, Integer pageSize, Integer pageNum) {
        return null;
    }

    @Override
    public int insertSceneryComment(SceneryComment sceneryComment) {
        return sceneryCommentMapper.insert(sceneryComment);
    }

    @Override
    public int insertReviewComment(ReviewComment reviewComment) {
        return reviewCommentMapper.insert(reviewComment);
    }

    @Override
    public int insertHotelComment(HotelComment reviewComment) {
        return hotelCommentMapper.insert(reviewComment);
    }

    @Override
    public int insertGuideComment(GuideComment reviewComment) {
        return guideCommentMapper.insert(reviewComment);
    }

    @Override
    public int insertDestinationComment(DestinationComment reviewComment) {
        return destinationCommentMapper.insert(reviewComment);
    }

    @Override
    public int insertDelicacyComment(DelicacyComment reviewComment) {
        return delicacyCommentMapper.insert(reviewComment);
    }

    @Override
    public int insertProductComment(ProductComment reviewComment) {
        return productCommentMapper.insert(reviewComment);
    }

    @Override
    public PageData<CommentListItemVO> listByArticle(Long articleId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return PageInfoToPageDataConverter.convert(new PageInfo<>(guideCommentMapper.selectByArticleId(articleId)));

    }

    @Override
    public PageData<CommentListItemVO> listByDelicacy(Long delicacyId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return PageInfoToPageDataConverter.convert(new PageInfo<>(delicacyCommentMapper.selectByDelicacyId(delicacyId)));
    }

    @Override
    public PageData<CommentListItemVO> listByDestination(Long destinationId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return PageInfoToPageDataConverter.convert(new PageInfo<>(destinationCommentMapper.selectByArticleId(destinationId)));
    }

    @Override
    public PageData<CommentListItemVO> listByHotel(Long hotelId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return PageInfoToPageDataConverter.convert(new PageInfo<>(hotelCommentMapper.selectByArticleId(hotelId)));
    }

    @Override
    public PageData<CommentListItemVO> listByProduct(Long productId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return PageInfoToPageDataConverter.convert(new PageInfo<>(productCommentMapper.selectByArticleId(productId)));
    }

    @Override
    public PageData<CommentListItemVO> listByReview(Long reviewId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return PageInfoToPageDataConverter.convert(new PageInfo<>(reviewCommentMapper.selectByArticleId(reviewId)));
    }

    @Override
    public PageData<CommentListItemVO> listByScenery(Long sceneryId, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return PageInfoToPageDataConverter.convert(new PageInfo<>(sceneryCommentMapper.selectByArticleId(sceneryId)));
    }

    @Override
    public PageData<SecondCommentVo> getProductSecondComments(Long commentId, Integer pageNum, Integer pageSize) {
        return null;
    }

    @Override
    public PageData<SecondCommentVo> getScenerySecondComments(Long commentId, Integer pageNum, Integer pageSize) {
        return null;
    }

    @Override
    public PageData<SecondCommentVo> getReviewSecondComments(Long commentId, Integer pageNum, Integer pageSize) {
        return null;
    }

    @Override
    public PageData<SecondCommentVo> getHotelSecondComments(Long commentId, Integer pageNum, Integer pageSize) {
        return null;
    }

    @Override
    public PageData<SecondCommentVo> getDelicacySecondComments(Long commentId, Integer pageNum, Integer pageSize) {
        return null;
    }

    @Override
    public PageData<SecondCommentVo> getGuideSecondComments(Long commentId, Integer pageNum, Integer pageSize) {
        return null;
    }

    @Override
    public PageData<SecondCommentVo> getDestinationSecondComments(Long commentId, Integer pageNum, Integer pageSize) {
        return null;
    }

    @Override
    public DestinationComment getDestinationSecondComment(Long commentId) {
        return null;
    }

    @Override
    public ProductComment getProductSecondComment(Long commentId) {
        return null;
    }

    @Override
    public SceneryComment getScenerySecondComment(Long commentId) {
        return null;
    }

    @Override
    public ReviewComment getReviewSecondComment(Long commentId) {
        return null;
    }

    @Override
    public HotelComment getHotelSecondComment(Long commentId) {
        return null;
    }

    @Override
    public DelicacyComment getDelicacySecondComment(Long commentId) {
        return null;
    }

    @Override
    public GuideComment getGuideSecondComment(Long commentId) {
        return null;
    }
}
